class CanvasInter{

    // initialization options
    options = {};

    // canvas 2d
    ctx = null;
    // mirror canvas 2d
    mctx = null

    // canvas width
    cWidth = 0;
    // canvas height
    cHeight = 0;
    constructor(options) {
        this.options = options;
        if(!this.options.el) {
            console.error('must need a canvas el')
            return ;
        }
        const canvasEl = document.getElementById(this.options.el);
        this.ctx = canvasEl.getContext('2d');
        this.mctx = this.ctx;
        this.cWidth = canvasEl.width;
        this.cHeight = canvasEl.height;
    }

    addRect(left, top, width, height, style) {
        this.ctx.beginPath();
        this.ctx.fillStyle = style;
        this.ctx.fillRect(left, top, width, height);
        this.ctx.stroke();
        this.ctx.closePath();
    }

}
export default CanvasInter;